#ifndef API_H_
#define API_H_

#include "../data_link/data_link.h"

#define BAUDRATE B38400
#define _POSIX_SOURCE 1 /* POSIX compliant source */

// Packet Declarations
#define DATA_SIZE 256
#define FILE_SIZE 0x00
#define FILE_NAME 0x01

#define DPACKET 0x00
#define CPACKET_START 0x01
#define CPACKET_END 0x02

#define SIZEOF_INT 0x04

#define CPACKET_HEADER_SIZE 9
#define DPACKET_HEADER_SIZE 4
#define PACKET_MAX_SIZE (DATA_SIZE + CPACKET_HEADER_SIZE)

extern int baudrate;
/**
@param port device identifier (TTYS0 or TTYS1)
@param flag entity identifier (RECEIVER or SENDER)
*/
int llopen(int port, char flag);

/**
@param fd file descriptor of device (returned by llopen)
*/
int llclose(int fd);

/**
@param fd data connection identifier
@param buffer string to transmit
@param length size of buffer
*/
int llwrite(int fd, char *buffer, int length);

/**
@param fd data connection identifier
@param buffer string to be 
*/
int llread(int fd, char *buffer);

#endif // API_H_
